home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Applications / Moscow ML 1.31 / source code / mosml / src / test / testa.sml < prev    next >
Encoding:
Text File  |  1996-07-03  |  434 b   |  29 lines  |  [TEXT/R*ch]

  1. fun even 0 = true
  2.   | even x = odd(x-1)
  3. and odd  0 = false
  4.   | odd  x = even(x-1);
  5.  
  6. even 10; even 11;
  7.  
  8. datatype 'a X = X of string;
  9.  
  10. val stripX = fn X u => u;
  11. stripX (X "OK");
  12.  
  13. val stripX666 = fn X "666" => X "000" | x => x;
  14. stripX666 (X "666");
  15. stripX666 (X "OK");
  16.  
  17. datatype XXX =
  18.     A of int * int
  19.   | B of int * int;
  20.  
  21. val a12 = A(1,2)
  22. and b12 = B(1,2);
  23.  
  24. fun strip (A x) = x
  25.   | strip (B x) = x;
  26.  
  27. a12 = b12;
  28. strip a12 = strip b12;
  29.